package com.tarzan.oauth.feign.fallback;

import com.tarzan.api.model.response.user.SysUserDetailInfoResp;
import com.tarzan.api.model.response.user.SysUserInfoResp;
import com.tarzan.common.core.base.BaseResponse;
import com.tarzan.oauth.feign.RemoteUserService;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Package com.tarzan.oauth.feign.fallback
 * @Title RemoteUserServiceFallBackImpl
 * @Description TODO
 * @Author liujinshan
 * @CreateTime 2021/7/1 16:01
 */
@Slf4j
@Service
public class RemoteUserServiceFallBackImpl implements RemoteUserService {


    private Throwable cause;

    public Throwable getCause() {
        return cause;
    }

    public void setCause(Throwable cause) {
        this.cause = cause;
    }

    /**
     * @title findUserInfoByUserName
     * @description TODO 远程调用失败是兜底的方法
     * @param username
     * @return com.tarzan.common.core.base.BaseResponse<com.tarzan.api.model.response.user.SysUserInfoResp>
     * @author liujinshan
     * @data 2021/7/1 16:07
     */
    @Override
    public BaseResponse<SysUserDetailInfoResp> findUserInfoByUserName(String username) {
        log.error("feign 查询用户信息失败:{}", username, cause);
        BaseResponse<SysUserDetailInfoResp> response = new BaseResponse<>();
        return response;
    }
}
